package com.lsu.app.mapper;

import com.lsu.app.bean.ClickDate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;


/**
 *
 * @description 针对表【click_date(课程点击量)】的数据库操作Mapper
 * @Date 2023-11-14 20:26:04
 * @author hjj
 */
@Mapper
public interface ClickDateMapper extends BaseMapper<ClickDate> {
    @Update("update click_date set click_num=click_num+1 where id=#{id}")
    void updateClickNumById(Integer id);
    @Select("select id from click_date where course_id=#{courseId} and cul_date = #{date} and type=0")
    Integer getIdByCourseIdAndDate(@Param("courseId") Integer courseId, @Param("date") String date);
    @Select("select SUM(click_num) from click_date where cul_date=#{date} and teacher_id=#{teacherId} and type=0")
    Integer getClickByDate(@Param("teacherId") Integer teacherId, @Param("date") String date);
    @Select("select click_num from click_date where course_id=#{courseId} and type=1")
    Integer getClickNumOfCourseTalk(Integer courseId);//获取课程话题点击次数
    @Select("select teacher_id from course where id=#{courseId}")
    Integer getTeacherIdByCourseId(Integer courseId);
}




